<template>
  <div class="container">
    <van-nav-bar
      @click-left="$router.push('/profile')"
      left-arrow
      title="收藏/历史"
    />
    <van-tabs v-model="active">
      <van-tab title="收藏">
        <load-list :type="0" />
      </van-tab>
      <van-tab title="历史">
        <load-list :type="1" />
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import LoadList from './chi-coms/load-list'
import { mapMutations } from 'vuex'

export default {
  name: "ColHis",
  components: {LoadList},
  computed: {
  },
  data() {
    return {
      active:this.$route.params.type,
      // type:$route.params.type
    };
  },
  created() {
  },
  mounted() {},
  methods: {
    ...mapMutations(['addCachePages','removeCachePage'])
  },
  beforeRouteLeave (to, from, next) {
    if(to.fullPath.includes('article')){
      this.removeCachePage('ColHis')
    }else{
      this.addCachePages('ColHis')
    }
    next()
  }
};
</script>

<style scoped lang="stylus" >
.container
  padding-top 90px
  .van-nav-bar
    position fixed
    top 0
    right 0
    left 0
    height 46px 
/deep/ .van-tabs__line
  background-color #3196fa
/deep/ .van-tabs__wrap
  position fixed
  left 0
  right 0
  height 44px
  top 46px
  z-index 10
</style>